#ifndef VD_STRUCT_H_
#define VD_STRUCT_H_

#include <stdint.h>
#include "stdbool.h"

#pragma pack(push,1)
typedef struct net_cfg_s
{
	uint32_t rip;
	uint16_t rport;
	uint32_t lip;
	uint16_t lport;
	uint32_t mask;
	uint32_t gateway;
	uint8_t  mac[6];
	uint8_t  mqtt;
	uint32_t qip;
	uint16_t qport;
	uint8_t  qusr[64];
	uint8_t  qpswd[64];
	uint8_t  qtopic[128];
	uint8_t  qos;
	uint8_t  devid[64];
}net_cfg_t;

typedef struct ch_cfg_s
{
	uint8_t mask;
	uint8_t type;
	uint8_t baudrate;
	uint8_t model;
	uint8_t protocols;
	uint8_t ext1;
	uint8_t ext2;
	uint8_t ext3;
}ch_cfg_t;

typedef struct rs485_cfg_s
{
	uint8_t id;
	uint8_t mask;
	uint8_t baudrate;
	uint8_t protocol;
	uint8_t model;
	uint8_t dict;
	uint8_t ext1;
	uint8_t ext2;
	uint8_t ext3;
	uint8_t ext4;
}rs485_cfg_t;

typedef struct alg_cfg_s
{
	uint32_t insert_coil;	// 
	uint32_t cm_thold;
	uint32_t go_thold;
	uint32_t cm_cnt;
	uint32_t go_cnt;
	uint32_t interval;
	uint32_t mode;
}alg_cfg_t;

typedef struct io_cfg_s
{
	uint8_t io;
	uint8_t low;
	uint8_t high;
}io_cfg_t;

typedef struct tm_s
{
	uint16_t year;
	uint8_t month;
	uint8_t day;
	uint8_t hour;
	uint8_t min;
	uint8_t sec;
}tm_t;


typedef struct ver_s
{
	uint8_t ver[32];
}ver_t;

typedef struct cpu_info
{
	union {
		uint8_t  byte[12];
		uint32_t id[3];
	}v;
}cpu_t;

typedef struct flash_s
{
	uint16_t sector;
	uint32_t state;
}flash_t;

typedef struct auth_s
{
	uint8_t code[12];
}auth_t;

typedef struct prg_file_s
{
	uint8_t flag;
	uint32_t size;
}prg_file_t;


#pragma pack(pop)


#endif // _VD_STRUCT_H_



